package guaqiuyuwaqiu.com.rest;


import guaqiuyuwaqiu.com.model.Member;

import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * JAX-RS Example
 * 
 * This class produces a RESTful service to read the contents of the members table.
 */
@Path("members")
public class MemberResourceRESTService {

   @GET
   @Produces(MediaType.APPLICATION_JSON)
   public List<Member> listAllMembers() {
      // Use @SupressWarnings to force IDE to ignore warnings about "genericizing" the results of
      // this query

      // We recommend centralizing inline queries such as this one into @NamedQuery annotations on
      // the @Entity class
      // as described in the named query blueprint:
      // https://blueprints.dev.java.net/bpcatalog/ee5/persistence/namedquery.html
      //final List<Member> results = em.createQuery("select m from Member m order by m.name").getResultList();
      List<Member> results=new ArrayList<Member>();
      return results;
   }

   @GET
   @Path("/{id:[0-9][0-9]*}")
   @Produces(MediaType.APPLICATION_JSON)
   public Member lookupMemberById(@PathParam("id") long id) {
	   Member m=new Member();
      return m;
   }
}
